<!-- 疫苗管理 -->
<template>
	<view class="VaccineManagement">
		<view class="th"></view>
		<view class="VaccineManagement-item" v-for="(item, index) in data" :key="index">
			<view class="VaccineManagement-item-top">
				<view class="VaccineManagement-item-top-left">
					<image src="@/static/imgs/cow.png" style="width: 70rpx;height: 70rpx;"></image>
					<view class="naber">
						<view>牲畜编号</view>
						<view>IMEI：{{item.F_IMEI}}</view>
					</view>
				</view>
				<view class="VaccineManagement-item-top-right">
					<i class="iconfont icon-xiangyoujiantou"></i>
				</view>
			</view>
			<view class="VaccineManagement-item-center">
				<view>疫苗批次号:{{item.F_Batch}}</view>
				<view>疫苗名称:{{item.F_Title}}</view>
			</view>
			<view class="VaccineManagement-item-footer">
				<view>操作员：{{item.F_Name}}</view>
				<view>{{formatTime(item.F_JzTime)}}</view>
			</view>
		</view>
		<navigator url="/pages/management/child/vaccine/AddVaccineManagement">
			<button class="btn">新增</button>
		</navigator>
	</view>
</template>

<script setup>
	import {ref,onMounted} from 'vue'
	import {getVaccineList} from '@/utils/api/Management.js'
	import dayjs from 'dayjs'
	const data=ref(null)
	//疫苗列表
	const list = async ()=>{
		let res = await getVaccineList({page:1,pageSize:100})
		data.value=res.data
	}
	onMounted(()=>{
		list()
	})
	
	//日期转换函数
	const formatTime = (time) => {
	    return dayjs(time).format('YYYY-MM-DD HH:mm:ss');
	}
</script>

<style scoped>
	@import '@/static/iconfont/iconfont.css';

	.VaccineManagement {
		width: 100%;
		min-height: 100vh;
		background-color: #F3F5F8;
	}

	.th {
		height: 20rpx;
	}

	.VaccineManagement-item {
		width: 90%;
		height: 340rpx;
		background-color: #fff;
		margin: 20rpx auto;
		border-radius: 20rpx;
		position: relative;
	}

	.VaccineManagement-item-top {
		height: 130rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.VaccineManagement-item-top-left {
		margin-left: 40rpx;
		display: flex;
		align-items: center;
	}

	.VaccineManagement-item-top-right {
		margin-right: 40rpx;
	}

	.VaccineManagement-item-center {
		height: 100rpx;
		margin-left: 40rpx;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
	}

	.VaccineManagement-item-footer {
		position: absolute;
		bottom: 0;
		left: 40rpx;
		height: 70rpx;
		width: 90%;
		display: flex;
		justify-content: space-between;
		border-top: 1rpx solid #ccc;
	}

	.naber {
		margin-left: 20rpx;
	}

	.btn {
		width: 100%;
		height: 90rpx;
		background-color: #0BCB75;
		position: fixed;
		/* 添加固定定位 */
		bottom: 0;
		/* 固定在屏幕底部 */
		left: 0;
		/* 水平方向居左对齐，如果要水平居中可通过其他方式调整 */
		z-index: 999;
		/* 确保按钮在其他元素之上显示，避免被遮挡 */
	}
</style>